home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / x2ftp / msdos / utils / uchain31 / unchain.doc < prev    next >
Text File  |  1993-12-01  |  13KB  |  387 lines

  1.   ══════════════════════════════════════════════════════════════════════════
  2.  
  3.                     UNCHAIN   Planar VGA Mode 13h Enforcer
  4.                             v3.1  December 1, 1993
  5.  
  6.               Copyright 1993 Colin Buckley.  All Rights Reserved.
  7.  
  8.                                 Colin Buckley
  9.                              151 Roxanne Cresent
  10.                                Scarborough, ON
  11.                                 Canada M1V 4G7
  12.  
  13.   Use or distribute freely in any environment. In other words, it's Freeware
  14.  
  15.   ══════════════════════════════════════════════════════════════════════════
  16.  
  17.  
  18. Introduction
  19. ════════════
  20.  
  21.     Borland development tools will only remember which video mode you are
  22. in, it doesn't save any possible video card register changes you might have
  23. made.
  24.  
  25.     There is a great deal of hype over "Mode X", but if you don't own
  26. a secondary video card (monochrome), it's impossible to debug in a Borland
  27. IDE.
  28.  
  29.     UNCHAIN will allow you to do just that.  It is all completely transparent
  30. to the user, only the viewing of video pages is interactive as it should be.
  31. UNCHAIN can also restore your palette.  Palette restoring works indepentently
  32. of the VGA register savings, so you can use UNCHAIN to restore the palette in
  33. regular Mode 13h aswell.
  34.  
  35.  
  36. Usage
  37. ═════
  38.  
  39.     There are two versions of UNCHAIN, one spawns your program and the
  40. other is a TSR which remains in memory.  There are advantages and disadvantabes
  41. to both.
  42.  
  43.     UNCHAIN requires 3K and requires you to specify the full path to
  44. the file you wish to enforce planar modes.  However, it is only active
  45. while your program is active and will not cause problems to other programs
  46. entering Mode 13h.  The full file names didn't bother me, but others hated it.
  47.  
  48.     UNCHAINR requires about 1.5K and can be loaded and unload like other
  49. TSRs, if no TSRs were loaded after it.  It can be loaded into high memory by
  50. DOS's LOADHIGH or third-party memory managers.  UNCHAINR will even be able to
  51. remove itself from high memory if it was the last loaded TSR.  You do not
  52. have to type long file names, but UNCHAINR can cause problems for other
  53. programs.  A commandline switch is provided to reset UNCHAINR if that
  54. happens, but it's possible to forget about UNCHAINR being resident.
  55.  
  56.  
  57. UNCHAIN Usage
  58. ═════════════
  59.  
  60.     UNCHAIN requires <3K of memory.
  61.  
  62.     If you use...
  63.  
  64.       >TD YourGame.EXE <YourGame commandline options>
  65.  
  66.     then use...
  67.  
  68.       >UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
  69.  
  70.     Note the addition of the extension for TD.  If TD.EXE is not in the
  71. current directory, you will have to use the entire filename, such as...
  72.  
  73.       >UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
  74.  
  75.     UNCHAIN will spawn TD and Turbo Debugger will load your game and operate
  76. as usual.
  77.  
  78.  
  79. UNCHAIN Resident Usage
  80. ═══════════════════════
  81.  
  82.     UNCHAINR requires <2K of memory.
  83.  
  84.     Type...
  85.  
  86.     >UNCHAINR
  87.  
  88.     to installed UNCHAIN in memory.  "/I" installs, but it's not necessary.
  89.  
  90.     Type...
  91.  
  92.     >UNCHAINR /U
  93.  
  94.     to uninstall UNCHAIN from memory.
  95.  
  96.     Type...
  97.  
  98.     >UNCHAIN /R
  99.  
  100.     to reset the enforcing flag.  If you experience a program that looks
  101.     visually corrupt (only 1/4 of the screen looks visable and it has large
  102.     pixels with big gaps between lines), run with this switch.  If the problem
  103.     does not go away, then UNCHAIN is not at fault.
  104.  
  105.     Any other switch will give you a help screen.
  106.  
  107.  
  108. UNCHAIN Video BIOS Extentions
  109. ═════════════════════════════
  110.  
  111.     Any following reference to UNCHAIN applies to both versions.
  112.  
  113.     You must add some assembler instructions in order for this program to
  114. work transparently.  If the instructions are not present, the program
  115. will act like it was not loaded.
  116.  
  117.     If you are unfamiliar with assembler, in Turbo/Borland Pascal use..
  118.  
  119.     ASM
  120.       Assembler Instructions
  121.     End;
  122.  
  123.     In Turbo/Borland C/C++ use...
  124.  
  125.     asm{
  126.       Assembler Instructions
  127.     }
  128.  
  129.  
  130.     After you have entered Mode 13h and modified the VGA registers, use the
  131. following code...
  132.  
  133.       MOV  AX,0CB00h
  134.       INT  10h
  135.  
  136.     The above code is the only really necessary instructions.  If you
  137. are using the TSR, then you should add the reset code below, otherwise you do
  138. not have to add any of the following instructions unless you want these
  139. features aswell.
  140.  
  141.  
  142.     To reset the VGA registers saved by the above command, use the following
  143. code...
  144.  
  145.       MOV  AX,0CB06h
  146.       INT  10h
  147.  
  148.     The purpose of this command is to allow you to use Mode 13h and unchained
  149. modes together.  Place the above code before you enter Mode 13h, so
  150. UNCHAIN doesn't restore the VGA registers.  If you use multiple resolutions
  151. in your program, then it would be wise to use the above code before you
  152. enter each one, but not necessary.  It is also advised you use this command
  153. before exitting to DOS and in your error/exit handlers so you do not cause
  154. problems with the TSR version, UNCHAINR.
  155.  
  156.  
  157.     Every time you set the palette use the following code..
  158.  
  159.       MOV  AX,0CB05h
  160.       INT  10h
  161.  
  162.     If you do Screen Fades then they will run at half speed because UNCHAIN
  163. gets the palette everytime, assuming you add the above code to your SetPalette
  164. routine and it is called by your screen fade.  They will work at full speed
  165. when UNCHAIN is not loaded.
  166.  
  167.     I only use one palette per game, so I actually use the above code
  168. as part of the game after I set the palette.  It's not part of the SetPalette
  169. code, so I can avoid the fade slow down problem.
  170.  
  171.     Palette restoring works indepentently of the VGA register savings, so
  172. you can use UNCHAIN to restore the palette in regular Mode 13h aswell.
  173.  
  174.  
  175.     In order to view Video Pages, you must tell UNCHAIN the offsets of upto 4
  176. pages, then while looking at the USER SCREEN (ALT-F5), you may press CTRL-1
  177. for Page 1, CTRL-2 for Page 2, CTRL-3 for Page 3, CTRL-4 for Page 4.
  178.  
  179.     To tell UNCHAIN what offset Page 1 is at use the following code..
  180.  
  181.       MOV  BX,Page1Offset
  182.       MOV  AX,0CB01h
  183.       INT  10h
  184.  
  185.     To tell UNCHAIN what offset Page 2 is at use the following code..
  186.  
  187.       MOV  BX,Page2Offset
  188.       MOV  AX,0CB02h
  189.       INT  10h
  190.  
  191.     To tell UNCHAIN what offset Page 3 is at use the following code..
  192.  
  193.       MOV  BX,Page3Offset
  194.       MOV  AX,0CB03h
  195.       INT  10h
  196.  
  197.     To tell UNCHAIN what offset Page 4 is at use the following code..
  198.  
  199.       MOV  BX,Page4Offset
  200.       MOV  AX,0CB04h
  201.       INT  10h
  202.  
  203.     The following default offsets are set until you change them.
  204.  
  205.     Page 1 defaults to offset 0000          (Page 1 in 320x200)
  206.     Page 2 defaults to offset 16000         (Page 2 in 320x200)
  207.     Page 3 defaults to offset 32000         (Page 3 in 320x200)
  208.     Page 4 defaults to offset 48000         (Page 4 in 320x200)
  209.  
  210.     ******************************************************************
  211.     NOTE: DO NOT PRESS CTRL-x UNLESS YOU ARE VIEWING THE USER SCREEN
  212.  
  213.     It's not hazardous, atleast not to my SVGA card but...  View which
  214.     ever page points to OFFSET 0000 to restore your screen correctly.
  215.     ******************************************************************
  216.  
  217.     If you use a library, it would be best to add the code directly to
  218. the library routines so it's always set up correctly.  If UNCHAIN is not
  219. loaded the added instructions should do absolutely nothing.
  220.  
  221.  
  222. Applications that Work
  223. ══════════════════════
  224.  
  225.     I have only tested UNCHAIN with the following programs, and it works
  226. perfectly.  There is no screen corruption at all.
  227.  
  228.     Turbo Debugger v3.2:       Graphics Save = On
  229.                                Display Method = Swap Pages
  230.  
  231.     Turbo Profiler v2.2:       Graphics Save = On
  232.                                Display Method = Swap Pages
  233.  
  234.     Turbo Pascal v6:           Graphics Save = On
  235.  
  236.     Borland Pascal v7:         Graphics Save = On
  237.  
  238.  
  239.     UNCHAIN does work with Turbo and Borland C/C++, I was just never told
  240. what version(s) and options allowed it to work.
  241.  
  242.     For TD and TPROF it would be wise to save your setup as the default config
  243. file, rather then updating an EXE, so that all the TD and TPROF incarnations
  244. will be setup correctly.
  245.  
  246.     Please report all applications that work with UNCHAIN to me so I can
  247. update this list.  Please include the options necessary for it to work.
  248. My address is at the end of this file.
  249.  
  250.  
  251. Problems
  252. ════════
  253.  
  254. Problem:
  255.  
  256.     UNCHAIN is running but there are 4-16 smaller screens instead of the regular
  257. full screen.
  258.  
  259. Solution:
  260.  
  261.     UNCHAIN can not remove Chain 4 from Mode 13h, because you haven't added the
  262. assembler instructions to your code that UNCHAIN needs to operate transparently.
  263.  
  264.  
  265. Problem:
  266.  
  267.     UNCHAIN is running, I see the regular full screen, but portions of the
  268. screen become corrupt.
  269.  
  270. Solution:
  271.  
  272.     Change the display method the application UNCHAIN is spawning to use Swap
  273. Pages (which saves and restores the text screen to conventional memory, rather
  274. then VGA display memory) and set Graphics Save to On.  The Borland applications
  275. I run have display methods as a configuration option, with the exception
  276. of Borland Pascal, but it's method is still UNCHAIN friendly.
  277.  
  278.     If you're not using a Borland application, play around with the display
  279. methods, if that is not an option, or you still can't correct the screen,
  280. you'll have to live with it.
  281.  
  282.  
  283. Problem:
  284.  
  285.     UNCHAINR reports "UNCHAIN can not be removed from memory!"
  286.  
  287. Solution:
  288.  
  289.     You must unload any TSRs loaded after UNCHAIN before you can uninstall
  290. UNCHAIN.  The reason is some program has hooked on to one of the interrupts
  291. UNCHAIN uses (Keyboard and Video BIOS), and can not remove itself without
  292. leaving the system in an unstable state.
  293.  
  294.  
  295. Problem:
  296.  
  297.     UNCHAIN reports "Error: Can not execute file!"
  298.  
  299. Solution:
  300.  
  301.     COMMAND.COM is not executing the file, rather UNCHAIN is spawning it.
  302. Therefore you must specify the extension of the file you wish to execute,
  303. along with the entire path to the file, if it is not in the current directory.
  304.  
  305. For example...
  306.  
  307.     If you use...
  308.  
  309.       >TD YourGame.EXE <YourGame commandline options>
  310.  
  311.     ...and TD.EXE is in your path as being in C:\TD, you will have to use...
  312.  
  313.       >UNCHAIN C:\TD\TD.EXE YourGame.EXE <YourGame commandline options>
  314.  
  315.     ...unless it is in the current directory, in which case...
  316.  
  317.       >UNCHAIN TD.EXE YourGame.EXE <YourGame commandline options>
  318.  
  319.     ...is fine.
  320.  
  321. If you are already doing this then the file doesn't exist or there is some
  322. other problem preventing it from running like insufficent free memory.
  323.  
  324.  
  325. History
  326. ═══════
  327.  
  328. UNCHAIN v1.O -*- January 1, 1993
  329.  
  330.   o  Forced 320x200x256x4 only.
  331.  
  332. UNCHAIN v2.O -*- June 1, 1993
  333.  
  334.   o  Support for all the various resolutions possible in Planar Mode 13h
  335.   o  Palette saving and restoring
  336.   o  Viewing of upto 4 video pages
  337.  
  338. UNCHAIN v2.1 -*- June 1, 1993
  339.  
  340.   o  Help Screen updated
  341.   o  Minor bugs fixed
  342.   o  Memory resizing at runtime.
  343.   o  RESET function added
  344.   o  Palette saving and restoring now affecting colour 255.
  345.   o  Palette saving and restoring now independent of Planar modes and works
  346.      in regular Mode 13h
  347.   o  Video page viewing corrected
  348.   o  Keyboard ISR optimized, now works under TD386.
  349.   o  Documentation rewrote and heavily updated
  350.  
  351. UNCHAIN v3.O -*- November 1, 1993
  352.  
  353.   o  TSR version added.  Uses 1/2 as much memory, and can be loaded high.
  354.  
  355. UNCHAIN v3.1 -*- December 1, 1993
  356.  
  357.   o  Page Viewing was always active even if you weren't currently debugging,
  358.      so you always lost CTRL-1 to CTRL-4.  UNCHAIN now watches the Save Planar
  359.      state flag and only allows Page Viewing while debugging, allowing other
  360.      programs to use CTRL-1 to CTRL-4 while UNCHAIN is in memory.
  361.  
  362.  
  363. Credits
  364. ═══════
  365.  
  366.     The Planar Mode set routines were influenced by Themie's XLIB,
  367. who based his on Michael Abrash's, who got his from public domain code courtesy
  368. of John Bridges.
  369.  
  370.     The Video Page display routine was taken from John Slagel's XBLT as it
  371. used Display Enable.
  372.  
  373.     Everything else was pieced together from various code I had written in
  374. the past.
  375.  
  376.     The TSR code is all new and took about 2 hours to complete and debug.
  377.  
  378.     If you want to include and distribute this with your own library, code, or
  379. whatever go right ahead.
  380.  
  381. Colin Buckley
  382. Toronto, Ontario, Canada.
  383.  
  384. colin.buckley@canrem.com
  385.  
  386.   ══════════════════════════════════════════════════════════════════════════
  387.